package com.coderman.syncdb;

import com.alibaba.fastjson.JSON;
import com.coderman.utils.JdbcUtils;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Random;

/**
 * description: WriteDBService <br>
 * date: 2020/9/18 23:12 <br>
 * author: coderman <br>
 * version: 1.0 <br>
 */
public class WriteDBService {
    public static void main(String[] args) throws IOException {
        String path = "E:\\workspace\\newWorkspace\\data_collection\\area-collection\\src\\main\\resources\\jdbc.properties";
        try {
            JdbcUtils.initDBConnection(path);
        } catch (Exception e) {
            e.printStackTrace();
        }
        File all = new File("E:\\轻蜗牛直租平台项目\\中国所有小区-sql");
        for (File child : all.listFiles()) {
            List<String> list = FileUtils.readLines(child, "UTF-8");
            System.out.println(list.size()+"======");
            try {
                JdbcUtils.exeBatchSql(list);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    }
}
